var MsgRule = function() {
	var msgRuleInit = function(){
		$('#datatable-responsive').DataTable({
              "processing": true,
              "serverSide": true,
              "searchDelay": 800,
              "search":{
                  regex:true,
              },
              "ajax": {
                  // ajax请求地址
                  'url': '/wechatapi/msgrule/ajaxIndex',
            },
            // 注意: 这里列的数量必须和页面th标签数据量一致，否则会报错
            // orderable： 排序，默认为true
            "columns": [
            {
                "data": "id",
                "name": "id",
                "orderable": false,
            },
            {
                "data": "minute",
                "name": "minute",
            },
            {
                "data": "msg",
                "name": "msg",
                "orderable" : false,
            },
            {
                "data": "type",
                "name": "type",
                "orderable": false, 
                "render": function (data, type, row) {
                    if (data == 1) {
                        return "关注回复";
                    } else {
                        return "未知";
                    }
                    return data;
                }
            },
            {
              "data": "created_at",
              "name": "created_at",
              "orderable" : true,
            },{
              "data": "updated_at",
              "name": "updated_at",
              "orderable" : true,
            },{
              "data": "actionButton",
              "name": "actionButton",
              "type": "html",
              "orderable" : false,
            }],
        });
	}
	return {
        init : msgRuleInit
    }
}();
